#include "Mesh.h"
#include <iostream>

int main()
{
    vector<double> p0 = {-1, -1};
    vector<double> p1 = {0, 1};
    vector<double> p2 = {1, 1};
    vector<double> p3 = {-1, 1};
    Point<2> P0(p0);
    Point<2> P1(p1);
    Point<2> P2(p2);
    Point<2> P3(p3);
    vector<Point<2>> d = {P0, P1, P2, P3};
    Domain<2> *D = new Rectangle2D(d);
    vector<int> seg = {4, 4};
    Mesh<2> *M1 = new Q1Mesh(D, seg);
    M1->distributeDofs();
    M1->setBoundaryIndex();
    for (int i = 0; i < 4; i++)
        cout << M1->getIndexofGrid(2)[i].first << ", " << M1->getIndexofGrid(2)[i].second << endl;

    for (auto &grid : M1->getBoundaryGrid())
        cout << grid.getVertices(0) << endl;

    Mesh<2> *M2 = new Q2Mesh(D, seg);
    M2->distributeDofs();
    M2->setBoundaryIndex();
    for (int i = 0; i < 9; i++)
        cout << M2->getIndexofGrid(0)[i].first << ", " << M2->getIndexofGrid(0)[i].second << endl;
    return 0;
}
